import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class MyWidget(QWidget):

    def __init__(self):
        super().__init__()
        ##self.setGeometry(0, 0, 800, 600)
        self.resize(800, 600)
        self.setWindowTitle("PyQt Camera")


    def closeEvent(self, QCloseEvent):
        reply = QMessageBox.question(self, "信息", "你确定要退出吗?", QMessageBox.Yes, QMessageBox.No)
        if reply == QMessageBox.Yes:
            QCloseEvent.accept()
        else:
            QCloseEvent.ignore()


myapp = QApplication(sys.argv)
mywidget = MyWidget()
mywidget.show()
sys.exit(myapp.exec_())